namespace SharpPlanetsModel {

  public abstract class MassiveSpaceObject: SpaceObject {
    protected double mass;
    protected double density;
    public MassiveSpaceObject() {
    }
    /// <summary>
    /// gives the gravity effect on the y axis of the planet over one point
    /// </summary>
    /// <param name="p">oosition of the point</param>
    /// <returns>the y deviation of the point caused by planet's gravity field</returns>
    public double gravityEffectY(Position p) {
      double distanza_y, distanza, forzag;
      //distanza_x = this.CenterPosition.getXAbs() - p.getXAbs();
      distanza_y = Utilities.GetYDistanceBetweenPoints(p, this.CenterPosition);
      distanza = Utilities.GetDistanceBetweenPoints(p, this.CenterPosition);
      forzag = mass / System.Math.Pow(distanza, 2);
      return forzag * distanza_y / distanza; // deviazione y      
    }

    /// <summary>
    /// gives the gravity effect on the x axis of the planet over one point
    /// </summary>
    /// <param name="p">position of the point</param>
    /// <returns>the x deviation of the point caused by planet's gravity field</returns>
    public double gravityEffectX(Position p) {
      double distanza_x, distanza, forzag;
      distanza_x = Utilities.GetXDistanceBetweenPoints(p, this.CenterPosition);
      distanza = Utilities.GetDistanceBetweenPoints(p, this.CenterPosition);
      forzag = mass / System.Math.Pow(distanza, 2); // costante di gravitazione
      return forzag * distanza_x / distanza; // deviazione x    
    }
  }
}
